package com.ymatou.iapi.cardservice.service;

import java.util.List;

import org.json.JSONObject;

import com.ymatou.iapi.cardservice.parameter.AccountingItemModel;
import com.ymatou.iapi.cardservice.parameter.AccountingRequest;
import com.ymttest.business.YmatouAutoTestCall;
import com.ymttest.utils.EnvSetup;

public class AccountingCall extends YmatouAutoTestCall{
	private static String opurl ="/api/card/accounting";
	
	public AccountingCall() {
		super(EnvSetup.getSystemUrl("cardservice"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	
	public JSONObject call(List<AccountingItemModel> accountingItemModelList) {
		return this.call(accountingItemModelList,"testapp.iapi.ymatou.com");
	}
	
	
	public JSONObject call(List<AccountingItemModel> accountingItemModelList,String appId) {
		AccountingRequest accountingRequest = new AccountingRequest();
		accountingRequest.setAppId(appId);
		accountingRequest.setAccountingItems(accountingItemModelList);
		return this.callAndGetReturnData(accountingRequest);
	}
	
}
